<%@language=vbscript%>
<%
	Session("FormName")="F20"
	Session("VanBan")=""
%>
<!--#include file="..\CheckSession.inc"-->
<!--#include file="..\pageSelected.inc"-->
<!--#include file=..\getFormName.inc-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="vi">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title></title>
</head>
<!--#include file="..\RootContent.inc"-->
<!--#include file="..\jvGrid.inc"-->
<%	
	'bg thphuc 25/02/03
	if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),4)="1" or Session("IsAdmin") then
		bhienthi="1"
	end if
	'ed thphuc 25/02/03
	bComm=Request("bComm")	
	bNam=request("bNam")
' HienSX	
	sort=request("sort")
	if sort="" then sort="RevDate"
	Select case sort
		Case "Date":
			oSQL=" order by ngayky,so,soghinhan"
			bImgDate="../Images/up.gif"
			bImgSymbol=""
			bImgSubject=""
		Case "RevDate":
			oSQL=" order by ngayky DESC,so DESC,soghinhan DESC"
			bImgDate="../Images/down.gif"
			bImgSymbol=""
			bImgSubject=""
		Case "Symbol":
			oSQL=" order by so,soghinhan,ngayky"
			bImgDate=""
			bImgSymbol="../Images/up.gif"
			bImgSubject=""
		Case "RevSymbol":
			oSQL=" order by so DESC,soghinhan DESC,ngayky DESC"
			bImgDate=""
			bImgSymbol="../Images/down.gif"
			bImgSubject=""
		Case "Subject":
			oSQL=" order by Trichyeu,ngayky,so,soghinhan"
			bImgDate=""
			bImgSymbol=""
			bImgSubject="../Images/up.gif"
		Case "RevSubject":
			oSQL=" order by Trichyeu DESC,ngayky DESC,so DESC,soghinhan DESC"
			bImgDate=""
			bImgSymbol=""
			bImgSubject="../Images/down.gif"
		Case "Attach":
			oSQL=" order by attach"
			bImgDate=""
			bImgNum=""
			bImgSymbol=""
			bImgSubject=""		
		Case "RevAttach":
			oSQL=" order by attach DESC"
			bImgDate=""
			bImgNum=""
			bImgSymbol=""
			bImgSubject=""
	End Select

	Select case bComm
		case "delete"
			if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),4)="1" or Session("IsAdmin") then
				bSogoc=request("TxtSogoc")
				bSoghinhan=request("TxtSoghinhan")
				bID=request("TxtID")
				'Kiem tra xoa lien quan den muontratailieu
				sSQL="Select * from muontra where Trangthaimuon=1 and loaitailieu like '2' and  matailieu like '"& modistring(bID) &"'"
				Set RecKTMuon=server.CreateObject("ADODB.Recordset")
				RecKTMuon.CursorType=3
				RecKTMuon.CacheSize=5
				RecKTMuon.Open sSQL,Conn
				bNotDel=false
				if RecKTMuon.RecordCount then
					bNotDel=true
				end if
				RecKTMuon.Close
				Set RecKTMuon=nothing
				if not bNotDel then
				'Tao Transaction
				On Error resume next
				Conn.BeginTrans
				
				sSQL="Delete from VTDi where ID like '"& modistring(bID) &"'"
				Conn.Execute sSQL

				bTentep=Request("TxtTentep")

				sSQL="Delete from Quyen where Mavanthu like '"& modistring(bID) &"' and maLoaivanthu like '2'"
				Conn.Execute sSQL
				
				sSQL="Delete from vanban_vuviec where Mavanban like '"& modistring(bID) &"' and Loaivanban like '2'"
				Conn.Execute sSQL
		
				'Xoa noi dung file
				sSQL="Select * from vanban_Noidung where Mavanthu like '"& modistring(bID) &"' and Loaivanthu like '2'"
				set RecNoidung=server.CreateObject("ADODB.Recordset")
				RecNoidung.CursorType=3
				RecNoidung.CacheSize=5
				RecNoidung.Open sSQL,Conn
				'Xoa file dinh kem
				Set File = Server.CreateObject("ActiveFile.File")
				Do while not RecNoidung.EOF
					File.Name=RootContent & "Upload\"& cstr(bNam) &"\di\"& RecNoidung("Tentep")
					if File.Exists() then
						File.Delete()
					end if
					RecNoidung.MoveNext
					if Err.number<>0 then
						exit do
					end if
				Loop				
				
				'Xoa bang vanban_noidung
				sSQL="Delete from vanban_Noidung where Mavanthu like '"& modistring(bID) &"' and Loaivanthu like '2'"
				Conn.Execute sSQL
'Hien 21_05
				'Xoa file noi dung
				File.Name=RootContent & "Upload\"& cstr(bNam) &"\di\TEXT\"& replace(bID,"/","_") & ".VT"
				if File.Exists() then
					File.Delete()
				end if
				set File=nothing
				%><%=Err.Description%><%
				'Ket Thu Transaction
				if Err.number=0 then
					Conn.CommitTrans
					bTrangthai=1
				else
					Conn.RollbackTrans
					bTrangthai=0
				end if		
				'Ghi nhan Ai da login thanh cong				
				bHoten=Session("bHoten")
				bNgaygio=cstr(Date()) &" "& cstr(Time())
				bChucnang="C&#7853;p nh&#7853;t V&#259;n th&#432; &#273;i"
				bIDTailieu=bSoghinhan
				bDongtac="Xo&#225;"
				sSQL="insert into loguser(Tennguoisudung,ngaygio,chucnangdung,dongtac,IDTailieu,Trangthai) Values('"& bHoten _
					&"','"& bNgaygio &"','"& bChucnang &"','"& bDongtac &"','"& bIDTailieu &"','"& bTrangthai &"')"
				Conn.Execute sSQL	
				else
					bMsg="M&#227; v&#259;n th&#432; &#273;ang &#273;&#432;&#7907;c li&#234;n k&#7871;t kh&#244;ng th&#7875; xo&#225; &#273;&#432;&#7907;c"
				end if
				btcu="SELECT Quyen_Nhom.Mavanthu FROM Canbo INNER JOIN Canbo_Nhom ON Canbo.Macanbo =Canbo_Nhom.Macanbo INNER JOIN Nhom ON dbo.Canbo_Nhom.Manhom=Nhom.Manhom INNER JOIN Quyen_Nhom ON Nhom.Manhom =Quyen_Nhom.MaNhom WHERE (Canbo.Macanbo = '"& Session("bMaCB") &"') And Quyen_nhom.maloaivanthu like '2'"
				bt="SELECT Quyen_Nhom.Mavanthu FROM donvi inner join quyen_nhom on donvi.id = quyen_nhom.manhom where donvi.madonvi like '"& Session("bMaDonVi") &"' And Quyen_nhom.maloaivanthu like '2'"
				if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),2)="1" or Session("IsAdmin") then 
					if session("sSQLDi")="" then
						sSQL="Select "& session("TopNum") & " * from VTDi where ngayky >= '"& Session("Year") &"'" & oSQL
						bPrintValue="Select "& session("TopNum") & " * from VTDi where ngayky >= '"& Session("Year") &"'"
					else
						bPrintValue=session("sSQLDi")
						sSQL=session("sSQLDi") & oSQL
					end if
				else
					if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),4)="1" or Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),9)="1" then
						if session("sSQLDi")="" then
							sSQL="SELECT " & session("TopNum") & " VTDI.* FROM VTDI WHERE ((VTDI.Congcong=1) or (VTDI.Congcong=0 and donvixuly like '%"& Session("bMaDonVi") &"%') or (VTDI.Congcong=0 and (VTDI.ID  in ("& btcu &"))) or (VTDI.Congcong=0 and ((VTDI.ID  in ("& bt &")) or (VTDI.ID  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='2'))))) and ngayky >= '"& Session("Year") &"'" & oSQL

							bPrintValue="SELECT " & session("TopNum") & " VTDI.* FROM VTDI WHERE ((VTDI.Congcong=1) or (VTDI.Congcong=0 and donvixuly like '%"& Session("bMaDonVi") &"%') or (VTDI.Congcong=0 and (VTDI.ID  in ("& btcu &"))) or (VTDI.Congcong=0 and ((VTDI.ID  in ("& bt &")) or (VTDI.ID  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='2'))))) and ngayky >= '"& Session("Year") &"'"
						else
							bPrintValue=session("sSQLDi")
							sSQL=session("sSQLDi") & oSQL
						end if
					else
						if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),8)="1" then
							if session("sSQLDi")="" then
								sSQL="SELECT " & session("TopNum") & " VTDI.* FROM VTDI WHERE ((VTDI.Congcong=1) or (VTDI.Congcong=0 and donvixuly like '%"& Session("bMaDonVi") &"%') or (VTDI.Congcong=0 and (VTDI.ID  in ("& btcu &"))) or (VTDI.Congcong=0 and ((VTDI.ID  in ("& bt &")) or (VTDI.ID  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='2'))))) and trangthaiduyet=1 and ngayky >= '"& Session("Year") &"'" & oSQL

								bPrintValue="SELECT " & session("TopNum") & " VTDI.* FROM VTDI WHERE ((VTDI.Congcong=1) or (VTDI.Congcong=0 and donvixuly like '%"& Session("bMaDonVi") &"%') or (VTDI.Congcong=0 and (VTDI.ID  in ("& btcu &"))) or (VTDI.Congcong=0 and ((VTDI.ID  in ("& bt &")) or (VTDI.ID  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='2'))))) and trangthaiduyet=1 and ngayky >= '"& Session("Year") &"'"
							else
								bPrintValue=session("sSQLDi")
								sSQL=session("sSQLDi") & oSQL
							end if
						else
							if session("sSQLDi")="" then
								sSQL="SELECT " & session("TopNum") & " VTDI.* FROM VTDI WHERE ((VTDI.Congcong=1) or (VTDI.Congcong=0 and (VTDI.ID  in ("& btcu &"))) or  (VTDI.Congcong=0 and (VTDI.ID  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='2')))) and trangthaiduyet=1 and ngayky >= '"& Session("Year") &"'" & oSQL

								bPrintValue="SELECT " & session("TopNum") & " VTDI.* FROM VTDI WHERE ((VTDI.Congcong=1) or (VTDI.Congcong=0 and (VTDI.ID  in ("& btcu &"))) or  (VTDI.Congcong=0 and (VTDI.ID  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='2')))) and trangthaiduyet=1 and ngayky >= '"& Session("Year") &"'"
							else
								bPrintValue=session("sSQLDi")
								sSQL=session("sSQLDi") & oSQL
							end if
						end if
					end if
				end if
			end if
		case "search"
			bSoghinhan=request("TxtSogoc")
			bID=request("TxtID")
			bTukhoa=trim(Request("TxtTukhoa"))
			bTungay=Request("TxtTungay")
			bDenngay=Request("TxtDenNgay")
			bTrichyeu=trim(Request("TxtTrichyeu"))
				'bgphucth 08-01-03
					if bTrichyeu="" and bTukhoa="" and bSoghinhan="" and bID="" and bNhomCV="" then
						if bTungay=bDenngay then
							bNgayIn=bTungay
						end if
					end if
				'edphucth 08-01-03
			%><!--#include file="funcSearch.inc"--><%
		Case else
			btcu="SELECT Quyen_Nhom.Mavanthu FROM Canbo INNER JOIN Canbo_Nhom ON Canbo.Macanbo =Canbo_Nhom.Macanbo INNER JOIN Nhom ON dbo.Canbo_Nhom.Manhom=Nhom.Manhom INNER JOIN Quyen_Nhom ON Nhom.Manhom =Quyen_Nhom.MaNhom WHERE (Canbo.Macanbo = '"& Session("bMaCB") &"') And Quyen_nhom.maloaivanthu like '2'"
			bt="SELECT Quyen_Nhom.Mavanthu FROM donvi inner join quyen_nhom on donvi.id = quyen_nhom.manhom where donvi.madonvi like '"& Session("bMaDonVi") &"' And Quyen_nhom.maloaivanthu like '2'"
			if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),2)="1" or Session("IsAdmin") then 
				if session("sSQLDi")="" then
					sSQL="Select " & session("TopNum") & " * from VTDI where ngayky >= '"& Session("Year") &"'" & oSQL
					bPrintValue="Select " & session("TopNum") & " * from VTDI where ngayky >= '"& Session("Year") &"'"
				else
					bPrintValue=session("sSQLDi")
					sSQL=session("sSQLDi") & oSQL
				end if
			else
				if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),4)="1" or Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),9)="1" then
					if session("sSQLDi")="" then
						sSQL="SELECT " & session("TopNum") & " VTDI.* FROM VTDI WHERE ((VTDI.Congcong=1) or (VTDI.Congcong=0 and donvixuly like '%"& Session("bMaDonVi") &"%') or (VTDI.Congcong=0 and (VTDI.ID  in ("& btcu &"))) or (VTDI.Congcong=0 and ((VTDI.ID  in ("& bt &")) or (VTDI.ID  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='2'))))) and ngayky >= '"& Session("Year") &"'" & oSQL

						bPrintValue="SELECT " & session("TopNum") & " VTDI.* FROM VTDI WHERE ((VTDI.Congcong=1) or (VTDI.Congcong=0 and donvixuly like '%"& Session("bMaDonVi") &"%') or (VTDI.Congcong=0 and (VTDI.ID  in ("& btcu &"))) or (VTDI.Congcong=0 and ((VTDI.ID  in ("& bt &")) or (VTDI.ID  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='2'))))) and ngayky >= '"& Session("Year") &"'"
					else
						bPrintValue=session("sSQLDi")
						sSQL=session("sSQLDi") & oSQL
					end if
				else
					if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),8)="1" then
						if session("sSQLDi")="" then
							sSQL="SELECT " & session("TopNum") & " VTDI.* FROM VTDI WHERE ((VTDI.Congcong=1) or (VTDI.Congcong=0 and donvixuly like '%"& Session("bMaDonVi") &"%') or (VTDI.Congcong=0 and (VTDI.ID  in ("& btcu &"))) or (VTDI.Congcong=0 and ((VTDI.ID  in ("& bt &")) or (VTDI.ID  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='2'))))) and trangthaiduyet=1 and ngayky >= '"& Session("Year") &"'" & oSQL

							bPrintValue="SELECT " & session("TopNum") & " VTDI.* FROM VTDI WHERE ((VTDI.Congcong=1) or (VTDI.Congcong=0 and donvixuly like '%"& Session("bMaDonVi") &"%') or (VTDI.Congcong=0 and (VTDI.ID  in ("& btcu &"))) or (VTDI.Congcong=0 and ((VTDI.ID  in ("& bt &")) or (VTDI.ID  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='2'))))) and trangthaiduyet=1 and ngayky >= '"& Session("Year") &"'"
						else
							bPrintValue=session("sSQLDi")
							sSQL=session("sSQLDi") & oSQL
						end if
					else
						if session("sSQLDi")="" then
							sSQL="SELECT " & session("TopNum") & " VTDI.* FROM VTDI WHERE ((VTDI.Congcong=1) or (VTDI.Congcong=0 and (VTDI.ID  in ("& btcu &"))) or  (VTDI.Congcong=0 and (VTDI.ID  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='2')))) and trangthaiduyet=1 and ngayky >= '"& Session("Year") &"'" & oSQL

							bPrintValue="SELECT " & session("TopNum") & " VTDI.* FROM VTDI WHERE ((VTDI.Congcong=1) or (VTDI.Congcong=0 and (VTDI.ID  in ("& btcu &"))) or  (VTDI.Congcong=0 and (VTDI.ID  in (Select mavanthu from Quyen where macanbo='"& Session("bMaCB") &"'  and maloaivanthu='2')))) and trangthaiduyet=1 and ngayky >= '"& Session("Year") &"'"
						else
							bPrintValue=session("sSQLDi")
							sSQL=session("sSQLDi") & oSQL
						end if
					end if
				end if
			end if
	end select
	Set Rec=server.CreateObject("ADODB.Recordset")
	Rec.CursorType=3
	Rec.CacheSize=5
	'Rec.Open ssql,Conn	
	Dim nRecCount	' Number of records found
	Dim nPageCount	' Number of pages of records we have
	Dim nPage	' Current page number
	sPage=request("Page")
	nPage=CLng(sPage)
	if nPage="" then 
		nPage=1
	end if
	if sPage<>"" then
		Session("pagevtdi")=nPage
	else
		nPage=Session("pagevtdi")
	end if
	rec.Open ssql,Conn
	if  rec.EOF and rec.BOF then
		nPageCount=0
	end if	
	bDisplay=Request("bDisplay")
	if  bDisplay then
		sSQL="Select * from VTDi where ID like "& request("bID")
		Set RecDisplay=Server.CreateObject("ADODB.Recordset")
		RecDisplay.CursorType=3
		RecDisplay.CacheSize=5
		RecDisplay.Open sSQL,Conn
		if RecDisplay.RecordCount>0 then
			bSoghinhan=RecDisplay("Soghinhan")
			bID=RecDisplay("ID")
			bngayky=RecDisplay("ngayky")
			bTukhoa=RecDisplay("Tukhoa")
			bTrichyeu=RecDisplay("TRichyeu")
			bDuyet=RecDisplay("Trangthaiduyet")
			bChophep=RecDisplay("Congcong")
			Session("bTenVBdi")=RecDisplay("TRichyeu")
			sSQL="Select tentep from vanban_noidung where mavanthu like '"& bID &"' and Loaivanthu='2' order by Sothutu "
			Set RecVBND=server.CreateObject("ADODB.recordset")
			RecVBND.CursorType=3
			RecVBND.CacheSize=5
			RecVBND.Open sSQL,Conn
			if RecVBND.RecordCount>0 then
				bTenTep=RecVBND("tentep")
			end if
			
'			bTenTep=RecDisplay("Tentep")
		end if
		RecDisplay.Close
		set RecDisplay=nothing
		
		' Kiem tra quyen R/W/F
		if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),4)="1" or Session("IsAdmin") then
			bQuyen="F"
		else
			sSQL="Select * from Quyen Where Mavanthu like '"& bID &"' and Macanbo like '"& Session("bMaCB") &"' and maloaivanthu like '2'"
			Set RecKTQ=server.CreateObject("ADODB.Recordset")
			RecKTQ.CursorType=3
			RecKTQ.CacheSize=5
			RecKTQ.Open sSQL,Conn
			if RecKTQ.RecordCount>0 then
				bQuyen=RecKTQ("Quyen")
			end if
			RecKTQ.Close
			set RecKTQ=nothing
		end if
	end if
%>	
<%	if request("chuachon")="thongtin" then%>
		<p align=center><font face=Arial color=red>B&#7841;n c&#7847;n ch&#7885;n &#273;&#250;ng th&#244;ng tin c&#7847;n s&#7917;a</font></p>
<%	end if
%>
<!--#include file="..\jvfunction.inc"-->
<script language=VBScript runat=server>
	' H&#224;m &#273;&#7883;nh d&#7841;ng l&#7841;i ng&#224;y M/D/Y-> D/M/Y
	Function FormatDate(vDate)
	   If Not IsNull(vDate) Then
	        vM = Right("0" & Month(vDate), 2)
	        vD = Right("0" & Day(vDate), 2)
	        vY = Right("19" & Year(vDate), 4)
	        FormatDate = vD & "/" & vM & "/" & vY
	   End If
	End Function
	Function ModiString(mess_s)
		message = Replace("" & mess_s,"'", "''")
		ModiString=message
	End function
	Function SaveDate(vDate)
		dim bvitri1
		dim bvitri2
	   vDate=trim(cstr(vDate))
	   bvitri1=instr(1,vDate,"/")
	   bMonth=left(vDate,bvitri1-1)
	   bvitri2=instr(bvitri1+1,vDate,"/")
	   Dim Temp
	   Temp=right(vDate,len(vDate)-bvitri1)
	   bDay=left(Temp,bvitri2-bvitri1-1)
	   bYear=right(vDate,len(vDate)-bvitri2)
       SaveDate=bDay+"/"+bMonth+"/"+bYear
	End Function	
</script>	
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
//HienSX
function Sort(SortKey){
	if (document.Noidung.Sort.value.indexOf(SortKey)== -1)
		document.Noidung.Sort.value=SortKey;
	else {
		if (document.Noidung.Sort.value.indexOf('Rev')== -1)
			document.Noidung.Sort.value='Rev' + SortKey;
		else
			document.Noidung.Sort.value= SortKey;
	}
	Noidung.target="right"
	Noidung.action="frmdsvtdi.asp?sort=" + Noidung.Sort.value;
	Noidung.submit();
}
function SetFocus(){
	window.Noidung.CmdSearch.focus();
}

function ChangePage(){
	strURL=Noidung.page.value;
	window.Noidung.target="right";
	window.Noidung.action=strURL;
	window.Noidung.submit();
}

function CmdAdd_onclick() {
	window.Noidung.target="right";
//HienSX
	window.Noidung.action="frmVTDi.asp?bComm=add&sort=" + Noidung.Sort.value;
	window.Noidung.submit();
}

function CmdEdit_onclick() {
	if (Noidung.TxtSogoc.value==""){
		alert("Cho biết thông tin cần sửa");
		return false;
	}
	Noidung.TxtSogoc.disabled=false
	Noidung.TxtTrichyeu.disabled=false
	Noidung.TxtTuKhoa.disabled=false
	window.Noidung.target="right";
//HienSX
	window.Noidung.action="frmVTDi.asp?bComm=edit&sort=" + Noidung.Sort.value;
	window.Noidung.submit();
}
function CmdPrint_onclick(){
	if(trim(Noidung.PrintValue.value)!=""){
		Noidung.target="_blank";
		Noidung.action="frmprintdi.asp";
		Noidung.submit();
	}
}
function CmdSearch_onclick() {
	OpenW("");
	return;
	if (Noidung.TxtSogoc.disabled){
		Noidung.CmdDangkyVV.disabled=true;
		Noidung.CmdDelete.disabled=true;
		Noidung.CmdEdit.disabled=true;
		Noidung.CmdEmail.disabled=true;
		Noidung.CmdNoidung.disabled=true;
		Noidung.CmdPrint.disabled=true;
		//Noidung.Cmdworkflow.disabled=true;
		
		Noidung.CmdSearch.value="Tìm";
		Noidung.TxtSogoc.disabled=false;
		Noidung.TxtDenngay.disabled=false;
		Noidung.TxtTuKhoa.disabled=false;
		Noidung.TxtTungay.disabled=false;
		Noidung.TxtTrichyeu.disabled=false;
		Noidung.TxtSogoc.value="";
		//Noidung.TxtDenngay.value="<%=Formatdate(Date())%>";
		Noidung.TxtDenngay.value="";
		Noidung.TxtTuKhoa.value="";
		//Noidung.TxtTungay.value="<%=Formatdate(Date()-90)%>";
		Noidung.TxtTungay.value="";
		Noidung.TxtTrichyeu.value="";
		
		Noidung.TxtSogoc.focus();
		return false;
	}
	if(trim(Noidung.TxtTungay.value)!=""){
		if (!isDate(trim(Noidung.TxtTungay.value))){
			alert("Ngày không hợp lệ");
			Noidung.TxtTungay.focus();
			return false;
		}
		else
			if(trim(Noidung.TxtDenngay.value)==""){
				alert("Cho biết đến ngày");
				Noidung.TxtDenngay.focus();
				return false;
			}
	}
	if(trim(Noidung.TxtDenngay.value)!=""){	
		if (!isDate(trim(Noidung.TxtDenngay.value))){
			alert("Ngày không hợp lệ");
			Noidung.TxtDenngay.focus();
			return false;
		}
		else
			if(trim(Noidung.TxtTungay.value)==""){
				alert("Cho biết từ ngày");
				Noidung.TxtDenngay.focus();
				return false;
			}
	}
	window.Noidung.target="right";
	window.Noidung.action="frmdsvtdi.asp?bComm=search";
	window.Noidung.submit();
}

function CmdNoidung_onclick() {
	if (Noidung.TxtID.value!=""){
		window.Noidung.target="right";
		//window.Noidung.action="Xemquyen.asp?LoaiVt=2&bMa="+"<%=bID%>"+"&bSoVB="+"<%=bSoghinhan%>";
		window.Noidung.action="duyetcanbodvxl.asp?bstepduyet=0&MaVT="+"<%=bID%>"+"&bMaLoaiVT=2";
		window.Noidung.submit();
	}
	else{
		alert("Hãy chọn công văn cần xem");
	}
}
function CmdDelete_onclick() {	
	if (trim(Noidung.TxtSoghinhan.value)!=""){
		if(!confirm("Bạn có muốn xóa không?")){
			return false;	
		}
		window.Noidung.target="right"
		window.Noidung.action="frmdsvtdi.asp?page="+"<%=npage%>"+"&bComm=delete"+"&bNam="+"<%=bNam%>";
		window.Noidung.submit();
	}
	else{
		alert("Hãy chọn công văn muốn xóa");
	}
}
function CmdNoidungtep_onclick() {
	if(Noidung.TxtSoghinhan.value==""){
		alert("Chá»n công văn");
		return false;
	}
	<%if bQuyen="" or bQuyen="R" then%>
		alert("B&#7841;n kh&#244;ng c&#243; quy&#7873;n thay &#273;&#7893;i n&#7897;i dung &#273;&#7889;i v&#7899;i v&#259;n th&#432; n&#224;y");
		return false;
	<%end if%>
	window.Noidung.target="right"
	window.Noidung.action="upload.asp?filename="+Noidung.TxtTentep.value;
	window.Noidung.submit();
}
function CmdDangkyVV_onclick() {
	<%if bDisplay then%>
		<%if not bDuyet then%>
			alert("Công văn này chưa được duyệt nên không thể đăng ký được !");
			return false;
		<%end if%>
		window.Noidung.target="main";
//HienSX
		window.Noidung.action="dangkyvuviec/frmdangky.asp?LoaiVt=2&sort=" + Noidung.Sort.value;
		window.Noidung.submit();
	<%else%>
		alert("HÃ£y chá»n công văn cáº§n Ä‘Äƒng kÃ½");
	<%end if%>

}
function CmdEmail_onclick() {
	Noidung.target="_blank";
	Noidung.TxtTrichyeu.disabled=false;
	Noidung.action="compose.asp?bLoaiVt=2&bMa="+"<%=bID%>"+"&bNam="+"<%=bNam%>";
	if(Noidung.Send.value=="email"){
		Noidung.submit();
	}
	else{
		alert("Không tìm thấy địa chỉ");
	}
}
function OpenW(bCom){
//HienSX
	sort=Noidung.Sort.value;
	if(bCom=="print"){
		remote = window.open('frmsearchDI.asp?sort='+sort+'&bComm=VTDI&print=OK','new_page','width=600,height=225').focus();
	}
	else{
		remote = window.open('frmsearchDI.asp?sort='+sort+'&bComm=VTDI','new_page','width=600,height=225').focus();
	}
}
//-->
</SCRIPT>
<LINK href="../styles/styles.css" type=text/css rel=STYLESHEET>
<body bgcolor=#F8F9D9 leftmargin=2 topmargin=0 onload="SetFocus()">
<%if bMsg<>"" then%>
	<p align=center><font color=red><%=bMsg%></p>
<%end if%>
<form name="Noidung" method="post">
<Input TYPE="hidden" name="Sort" value="<%=sort%>">
<INPUT TYPE="hidden" name=PrintValue value="<%=bPrintValue%>">
<INPUT TYPE="hidden" name=btungay value="<%=btungay%>">
<INPUT TYPE="hidden" name=bdenngay value="<%=bdenngay%>">
<INPUT TYPE="hidden" name=NgayIn value="<%=bNgayIn%>">
<!-- Form nhap lieu -->
<table border="0" width="100%" bgcolor="#BDD5D0" style="Font-family:Times New Roman;font-size:12pt;BORDER-BOTTOM-STYLE: none; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid;border-collapse:collapse; border-left-color:#C0C0C0; border-right-color:#C0C0C0; border-top-color:#C0C0C0; border-bottom-color:#C0C0C0">
	<%if bDisplay then%>
		<Input type=hidden name=TxtTentep value='<%=bTentep%>'>
		<Input type=hidden name=TxtSoghinhan value='<%=bSoghinhan%>'>
		<Input type=hidden name=TxtID value='<%=bID%>'>
		<%Session("bMaVBDi")=bID%>
	<%else%>
		<Input type=hidden name=TxtTentep>
		<Input type=hidden name=TxtSoghinhan>
		<Input type=hidden name=TxtID>
	<%end if%>
    <tr>
      <TD WIDTH="100%" COLSPAN="6" BGCOLOR="#000080" ALIGN="CENTER"><FONT FACE='TIMES NEW ROMAN' COLOR="#FFFFFF" SIZE=3>CÔNG V&#258;N&nbsp; ĐI</FONT></TD>
    </tr>
   <tr>
	<td width="12%" nowrap>Ký hiệu</td>
	<td width="28%">
		<%if bDisplay then%>
			<input type="text" name="TxtSogoc" value='<%=bSoghinhan%>' Disabled style="font-family: Arial;width:100%" size="20"></td>
		<%else%>
			<input type="text" name="TxtSogoc" Disabled style="font-family: Arial;width:100%" ></td>
		<%end if%> 
	</td>
	 <td width="10%" align="center">Từ ngày</td>
     <td width="20%">
		<%if bDisplay then%>
			<input type='text' name='TxtTungay' value='<%=FormatDate(bngayky)%>' Disabled=true style="width:100%" size="20"></td>
		<%else%>
			<input type="text" name="TxtTungay" Disabled=true style="width:100%"></td>
		<%end if%>
      <td width="10%" align="center">Đến ngày</td>
      <td width="20%">
		<%if bDisplay then%>
			<input type="text" name="TxtDenngay" value='<%=FormatDate(bngayky)%>' Disabled=true style="width:100%" size="20"></td>
		<%else%>
			<input type="text" name="TxtDenngay" Disabled=true style="width:100%"></td>
		<%end if%>
      </tr>
       <tr>
      	<TD WIDTH="12%" nowrap>Trích yếu</TD>
      	<TD WIDTH="88%" COLSPAN="5">
      		<%if bDisplay then%>
				<textarea name="TxtTrichyeu" Disabled style="font-family:Arial;width:100%" rows=1 cols=82><%=bTrichyeu%></textarea>
			<%else%>
				<textarea name="TxtTrichyeu" Disabled style="font-family:Arial;width:100%" rows=1 cols=82></textarea>
			<%end if%>
      	</TD>
    </tr>    
      <tr>
        <td width="12%" nowrap>Từ khóa</td>
        <td width="88%" colspan="5">
        	<%if bDisplay then%>
			<input type="text" name="TxtTuKhoa" value='<%=bTukhoa%>' Disabled style="" style="width:100%" size="20">
		<%else%>
			<input type="text" name="TxtTuKhoa" Disabled style="width:100%" size="20">
		<%end if%>
      </tr>
  </table>
<!-- Buttons -->
<table border="0" width="100%" bgcolor="#BDD5D0" style="Font-family:arial;font-size:10pt;BORDER-BOTTOM-STYLE: none; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid;border-collapse:collapse; border-left-color:#C0C0C0; border-right-color:#C0C0C0; border-top-color:#C0C0C0; border-bottom-color:#C0C0C0">
  	<tr>
	    <td width="10%">
   		   <% if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),4)="1" or Session("IsAdmin") then %>
   				<Button name="CmdAdd" style="height: 25; position: relative; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdAdd_onclick()" accesskey="T"><u>T</u>hêm</Button>
		   <% else%>   			
   				<Button name="CmdAdd" disabled=true style="height: 25; position: relative; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdAdd_onclick()" accesskey="T"><u>T</u>hêm</Button>
		   <% end if%>   			
	    </td>
   		 <td width="10%">
	      <% if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),4)="1" or Session("IsAdmin") then %>
			<%if bDisplay then%>
				<Button name="CmdEdit" style="height: 25; position: relative; width:100%;font-family:Arial"  LANGUAGE=javascript onclick="return CmdEdit_onclick()" accesskey="S"><u>S</u>ửa</Button>
			<%else%>
				<Button disabled name="CmdEdit" style="height: 25; position: relative; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdEdit_onclick()" accesskey="S"><u>S</u>ửa</Button>
			<%end if%>
		  <%else%>
			<Button name="CmdEdit" disabled=true style="height: 25; position: relative; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdEdit_onclick()" accesskey="S"><u>S</u>ửa</Button>
		  <%end if%>
	    </td>
   		 <td width="10%">
   		  <% if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),4)="1" or Session("IsAdmin") then %>
				<%if bDisplay then%>
					<Button name="CmdDelete" style="height: 25; position: relative; width:100%;font-family:Arial"  LANGUAGE=javascript onclick="return CmdDelete_onclick()" accesskey="X"><u>X</u>óa</Button>
				<%else%>
					<Button disabled name="CmdDelete" style="height: 25; position: relative; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdDelete_onclick()" accesskey="X"><u>X</u>óa</Button>
				<%End if%>
   		  <% else%>
	   			<Button name="CmdDelete" disabled=true style="height: 25; position: relative; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdDelete_onclick()" accesskey="X"><u>X</u>óa</Button>
   		  <% end if%>
   		  
   		 </td>
	    <td width="13%">
          <%if bChophep or not(bDuyet) then%>
			<%if bChophep then%>
				<Button name="CmdNoidung" style=" height: 25; position: relative; width:100%;font-family:Arial" disabled=true LANGUAGE=javascript onclick="return CmdNoidung_onclick()" accesskey="P"><p>Công cộng</p></Button>
			<%else%>
				<Button name="CmdNoidung" style=" height: 25; position: relative; width:100%;font-family:Arial" disabled=true LANGUAGE=javascript onclick="return CmdNoidung_onclick()" accesskey="P"><p><u>P</u>hân quyền</p></Button>
			<%end if%>
		  <%else%>
			<%if bDisplay then%>
				<% if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),8)="1"  or Session("IsAdmin") then%>
					<Button name="CmdNoidung" style="height: 25; position: relative; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdNoidung_onclick()" accesskey="P"><p><u>P</u>hân quyền</p></Button>
				<%else%>
					<Button disabled name="CmdNoidung" style="height: 25; position: relative; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdNoidung_onclick()" accesskey="P"><p><u>P</u>hân quyền</p></Button>
				<%end if%>
			<%else%>
				<Button disabled name="CmdNoidung" style="height: 25; position: relative; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdNoidung_onclick()" accesskey="P"><p><u>P</u>hân quyền</p></Button>
			<%end if%>
		  <%end if%>
   		 </td>
   		 <td width="17%"> 
   		  <%if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),"F24",1)="1" or Session("IsAdmin") then %>
   			<%if bDisplay then%>
				<Button name="CmdDangkyVV" style="height: 25; position: relative; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdDangkyVV_onclick()" accesskey="D"><p><u>Đ</u>ăng ký vụ việc</p></Button>
			<%else%>
				<Button disabled name="CmdDangkyVV" style="height: 25; position: relative; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdDangkyVV_onclick()" accesskey="D"><p><u>Đ</u>ăng ký vụ việc</p></Button>
			<%end if%>
		  <%else%>
			<Button disabled=true name="CmdDangkyVV" style=" height: 25; position: relative; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdDangkyVV_onclick()" accesskey="D"><p><u>Đ</u>ăng ký vụ việc</p></Button>
		  <%end if%>
   		 </td>
   		 <td width="12%">
			<Button name="CmdSearch" style="height: 25; position: relative; width:100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdSearch_onclick()" accesskey="M"><p>Tì<u>m</u> kiếm</p></Button>
   		 </td>
   		 <td width="8%">
		 <% if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),3)="1" or Session("IsAdmin") then	%>
			<Button name="CmdPrint" style="height: 25; position: relative; width: 100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdPrint_onclick()" accesskey="I"><u>I</u>n</Button>
		<%else%>
			<Button disabled name="CmdPrint" style="height: 25; position: relative; width: 100%;font-family:Arial" LANGUAGE=javascript onclick="return CmdPrint_onclick()" accesskey="I"><u>I</u>n</Button>	
		<%end if%>
   		 </td>

		<%if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),5)="1" or Session("IsAdmin") then %>
   				<%if bDisplay then%>
		   		 <td width="8%">
					<Button name="CmdEmail" style="height: 25; position: relative;width: 100%; font-family:Arial" LANGUAGE=javascript onclick="return CmdEmail_onclick()" accesskey="G"><u>G</u>ửi</Button></td>
				<td width="12%">
					<Select size=1 name=Send style="font-family:Arial;width:100%">
						<option selected value="email">E-Mail</option>
						<option value="VPCP">VPCP</option>
						<option value="BT">Bản tin</option>
					</select></td>
				<%else%>
				<td width="8%">
					<Button disabled name="CmdEmail" style="height: 25; position: relative; width: 100%; font-family:Arial" LANGUAGE=javascript onclick="return CmdEmail_onclick()" accesskey="G"><u>G</u>ửi</Button></td>
				<td width="12%">
					<Select size=1 name=Send style="font-family:Arial;width:100%">
						<option selected value="email">E-Mail</option>
						<option value="VPCP">VPCP</option>
						<option value="BT">Bản tin</option>
					</select></td>
				<%end if%>
			<%else%>
				<td width="8%">
					<Button disabled=true name="CmdEmail" style="height: 25; position: relative; width: 100%; font-family:Arial" LANGUAGE=javascript onclick="return CmdEmail_onclick()" accesskey="G"><u>G</u>ửi</Button></td>
				<td width="12%">
					<Select size=1 name=Send style="font-family:Arial;width:100%">
						<option selected value="email">E-Mail</option>
						<option value="VPCP">VPCP</option>
						<option value="BT">Bản tin</option>
				</select></td>
			<%end if%>
   		 </td>	   	 
	  </tr>
	</table>
<!-- Danh sach cong van di -->
  <table border="0" width="100%" style="Border-color:#C0C0C0;BORDER-BOTTOM-STYLE: solid; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid">
  <tr bgcolor="#BDD5D0">
	  <td width="4%"></td>
		<td width="1%" align="center"><A onmouseover="window.status='';return true" HREF="javascript:Sort('Attach')">&nbsp;<IMG border=0 SRC="../images/attach.gif">&nbsp;</A></td>
	  
      <td width="18%" nowrap><A onmouseover="window.status='';return true" HREF="javascript:Sort('Symbol')"><b>Số, ký hiệu</b>&nbsp;&nbsp;
	  <% if bImgSymbol<>"" then %><IMG SRC="<%=bImgSymbol%>" BORDER=0><%end if%>
	  </A></td>
      <td width="18%" nowrap><A onmouseover="window.status='';return true" HREF="javascript:Sort('Date')">&nbsp;<b>Ngày ký</b>&nbsp;&nbsp;
  	  <% if bImgDate<>"" then %><IMG SRC="<%=bImgDate%>" BORDER=0><%end if%>
	  </A></td>
      <td width="60%" nowrap><A onmouseover="window.status='';return true" HREF="javascript:Sort('Subject')">&nbsp;<b>Trích yếu</b>&nbsp;&nbsp;&nbsp;
	  <% if bImgSubject<>"" then %><IMG SRC="<%=bImgSubject%>" BORDER=0><%end if%>
	  </A></td>
   <% 
	If Not Rec.Eof Then
		nRecCount = Rec.RecordCount
		Rec.PageSize = 20
		nPageCount = Rec.PageCount
		If nPage < 1 then
			nPage = 1			
		End If
		if nPage > nPageCount Then
			nPage=nPageCount
		end if
		cnt=(pg-1)*pgsize + 1		    
		STT=1
		'rec.AbsolutePage=nPage
		rec.AbsolutePage=Session("pagevtdi")
		howmanyrecs=0
		do while not Rec.EOF and howmanyrecs<rec.PageSize
			if (cnt/2=int(cnt/2)) then
				color="#eeeecc"
			else
				color="#F8F9D9"
			end if

			if rec("attach") then
				imagesAttach="<IMG border=0 SRC=../images/attach.gif>"
			else				
				imagesAttach=""
			end if
			
%>
	<%if "'" & Rec("ID") & "'"=Request("bID") then
		color="#BDD7D6"
	end if
	%>	
	<%if rec("Trangthaiduyet") then%>
		<%if mid(rec("donvixuly"),2,4) <> mid(Session("bMaDonVi"),1,4) and bhienthi <> "1" and not(rec("congcong")) then%>
			<tr id=mnu_<%=STT%> style="BORDER-RIGHT: #e7e7e7 1px solid; BORDER-TOP: #e7e7e7 1px solid; BORDER-LEFT: #e7e7e7 1px solid; COLOR: #666666; BORDER-BOTTOM: #e7e7e7 1px solid; HEIGHT: 21px; BACKGROUND-COLOR: <%=color%>" 
	 onmouseover="javascript:MouseOverMenu('mnu_<%=STT%>')" onmouseout="javascript:MouseOutMenu('mnu_<%=STT%>','<%=color%>')">
		<%Select case Rec("Tinhchat")
			case "01"%>
				<td width="4%" nowrap><a href="xemnoidung.asp?LoaiVt=2&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("ngayky"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thuthuong.gif></p></a></td>
			<%case "02"%>
				<td width="4%" ><a href="xemnoidung.asp?LoaiVt=2&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("ngayky"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thukhan.gif></p></a></td>
			<%case "03"%>
				<td width="4%" ><a href="xemnoidung.asp?LoaiVt=2&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("ngayky"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thumat.gif></p></a></td>
			<%Case "04"%>
				<td width="4%" ><a href="xemnoidung.asp?LoaiVt=2&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("ngayky"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thukhanmat.gif></p></a></td>
		<%end select%>               		
		     <td width="1%" nowrap><a href="xemnoidung.asp?LoaiVt=2&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("ngayky"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><%=imagesAttach%></p></a></td>        
			<td width="18%"><a style='cursor:hand;color:grey;text-decoration: none' href="frmdsVTDi.asp?bDisplay=True&page=<%=nPage%>&bID='<%=rec("ID")%>'&bNam=<%=year(Rec("ngayky"))%>&ComboPhanloai=<%=Rec("Phanloai")%>"><p align="left"><%=Rec("soghinhan")%></p></a></td>

			<td width="18%" ><a style='cursor:hand;color:grey;text-decoration: none' href="frmdsVTDi.asp?bDisplay=True&page=<%=nPage%>&bID='<%=Rec("ID")%>'&bNam=<%=year(Rec("ngayky"))%>&ComboPhanloai=<%=Rec("Phanloai")%>"><p align="center"><%=FormatDate(Rec("ngayky"))%></p></a></td>

			<td width="60%"><a style='cursor:hand;color:grey;text-decoration: none' href="frmdsVTDi.asp?bDisplay=True&page=<%=nPage%>&bID='<%=Rec("ID")%>'&bNam=<%=year(Rec("ngayky"))%>&ComboPhanloai=<%=Rec("Phanloai")%>"><p align="left"><%=Rec("trichyeu")%></p></a></td>
		  </tr>	
		<%else%>
		  <tr id=mnu_<%=STT%> style="BORDER-RIGHT: #e7e7e7 1px solid; BORDER-TOP: #e7e7e7 1px solid; BORDER-LEFT: #e7e7e7 1px solid; COLOR: #666666; BORDER-BOTTOM: #e7e7e7 1px solid; HEIGHT: 21px; BACKGROUND-COLOR: <%=color%>" 
	 onmouseover="javascript:MouseOverMenu('mnu_<%=STT%>')" onmouseout="javascript:MouseOutMenu('mnu_<%=STT%>','<%=color%>')">
		<%Select case Rec("Tinhchat")
			case "01"%>
				<td width="4%" nowrap><a href="xemnoidung.asp?LoaiVt=2&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("ngayky"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thuthuong.gif></p></a></td>
			<%case "02"%>
				<td width="4%" ><a href="xemnoidung.asp?LoaiVt=2&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("ngayky"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thukhan.gif></p></a></td>
			<%case "03"%>
				<td width="4%" ><a href="xemnoidung.asp?LoaiVt=2&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("ngayky"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thumat.gif></p></a></td>
			<%Case "04"%>
				<td width="4%" ><a href="xemnoidung.asp?LoaiVt=2&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("ngayky"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thukhanmat.gif></p></a></td>
		<%end select%>               		
		     <td width="1%" nowrap><a href="xemnoidung.asp?LoaiVt=2&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("ngayky"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><%=imagesAttach%></p></a></td>        
			<td width="18%"><a style='cursor:hand;color:blue;text-decoration: none' href="frmdsVTDi.asp?bDisplay=True&page=<%=nPage%>&bID='<%=rec("ID")%>'&bNam=<%=year(Rec("ngayky"))%>&ComboPhanloai=<%=Rec("Phanloai")%>"><p align="left"><%=Rec("soghinhan")%></p></a></td>

			<td width="18%" ><a style='cursor:hand;color:blue;text-decoration: none' href="frmdsVTDi.asp?bDisplay=True&page=<%=nPage%>&bID='<%=Rec("ID")%>'&bNam=<%=year(Rec("ngayky"))%>&ComboPhanloai=<%=Rec("Phanloai")%>"><p align="center"><%=FormatDate(Rec("ngayky"))%></p></a></td>

			<td width="60%"><a style='cursor:hand;color:blue;text-decoration: none' href="frmdsVTDi.asp?bDisplay=True&page=<%=nPage%>&bID='<%=Rec("ID")%>'&bNam=<%=year(Rec("ngayky"))%>&ComboPhanloai=<%=Rec("Phanloai")%>"><p align="left"><%=Rec("trichyeu")%></p></a></td>
		  </tr>
		  <%end if%>
      <%else%>
      <tr id=mnu_<%=STT%> style="BORDER-RIGHT: #e7e7e7 1px solid; BORDER-TOP: #e7e7e7 1px solid; BORDER-LEFT: #e7e7e7 1px solid; COLOR: #666666; BORDER-BOTTOM: #e7e7e7 1px solid; HEIGHT: 21px; BACKGROUND-COLOR: <%=color%>" 
 onmouseover="javascript:MouseOverMenu('mnu_<%=STT%>')" onmouseout="javascript:MouseOutMenu('mnu_<%=STT%>','<%=color%>')">
		<%Select case Rec("Tinhchat")
			case "01"%>
				<td width="4%" nowrap><a href="xemnoidung.asp?LoaiVt=2&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("ngayky"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thuthuong.gif></p></a></td>
			<%case "02"%>
				<td width="4%" ><a href="xemnoidung.asp?LoaiVt=2&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("ngayky"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thukhan.gif></p></a></td>
			<%case "03"%>
				<td width="4%" ><a href="xemnoidung.asp?LoaiVt=2&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("ngayky"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thumat.gif></p></a></td>
			<%Case "04"%>
				<td width="4%" ><a href="xemnoidung.asp?LoaiVt=2&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("ngayky"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><IMG border=0 SRC=Thukhanmat.gif></p></a></td>
		<%end select%>               
	     <td width="1%" nowrap><a href="xemnoidung.asp?LoaiVt=2&bMa=<%=Rec("ID")%>&bNam=<%=year(Rec("ngayky"))%>" target="_blank"><p align="center" title="Xem n&#7897;i dung v&#259;n th&#432;"><%=imagesAttach%></p></a></td>        
        <td width="18%"><a style='cursor:hand;color:red;text-decoration: none' href="frmdsVTDi.asp?bDisplay=True&page=<%=nPage%>&bID='<%=rec("ID")%>'&bNam=<%=year(Rec("ngayky"))%>&ComboPhanloai=<%=Rec("Phanloai")%>"><p align="left"><%=Rec("soghinhan")%></p></a></td>

		<td width="18%"><a style='cursor:hand;color:red;text-decoration: none' href="frmdsVTDi.asp?bDisplay=True&page=<%=nPage%>&bID='<%=Rec("ID")%>'&bNam=<%=year(Rec("ngayky"))%>&ComboPhanloai=<%=Rec("Phanloai")%>"><p align="center"><%=FormatDate(Rec("ngayky"))%></p></a></td>
        
		<td width="60%"><a style='cursor:hand;color:red;text-decoration: none' href="frmdsVTDi.asp?bDisplay=True&page=<%=nPage%>&bID='<%=Rec("ID")%>'&bNam=<%=year(Rec("ngayky"))%>&ComboPhanloai=<%=Rec("Phanloai")%>"><p align="left"><%=Rec("trichyeu")%></p></a></td>
      </tr>
      <%end if%>
		<%
			if  Session("VanBan")="" then
				Session("VanBan")= "-" & Rec("ID") 
			else
				Session("VanBan")=Session("VanBan") & "-" & Rec("ID") 
			end if
		%>
<%		STT=STT+1
			Rec.MoveNext
			cnt=cnt+1
			howmanyrecs=howmanyrecs+1
	loop
		Session("VanBan")=Session("VanBan") & "-" 
	end if
	rec.Close
	set rec=nothing
%>
 </table>
 <!-- Phan trang -->
<br>
<table width="98%" cellspacing=0 cellpadding=0 >
<tr>
<% if nPage > 0 and nPageCount > 0 then %>  
	<td width="20%"><b>Trang&nbsp; <%=Session("pagevtdi")%>/<%=nPageCount%></b></td>
	<td width= "80%" align="right">
	<% if nPageCount > 1 then %>    
		Chuyển nhanh tới trang:&nbsp;
		<select name="page" style="width:50;height:25;font-size:8pt" size=1 onchange="javaScript:ChangePage()">
			<% for i = 1 to nPageCount%>	
				<%	if bComm<>"search"  then
						strURL="frmdsvtdi.asp?page="+ cstr(i) + "&bComm="
					else
						strURL="frmdsvtdi.asp?page="+ cstr(i) + "&bComm=search &TxtSogoc=" +bSoghinhan+ "&TxtTungay=" +bTungay+ "&TxtDenngay=" +bdenngay+ "&TxtTukhoa=" +bTukhoa+ "&TxtTrichyeu=" +bTrichyeu
				end if %>
				<option value="<%=strURL%>" <%=chkSelected(i, Session("pagevtdi"))%>><%=i%></option>
			<% next %>    
		</select>
		</td>                                  
	<% end if %>             
<% 'else %>
<% end if %>
  </tr>
</table>
</body>
</form>
</font>
</html>
<%
	Conn.Close
	set Conn=nothing
%>